home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5426 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Limit on #bytes inside of struct?
  5. Date: Fri, 09 Feb 96 13:45:13 GMT
  6. Organization: none
  7. Message-ID: <823873513snz@genesis.demon.co.uk>
  8. References: <4feg1d$d4g@cville-srv.wam.umd.edu>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4feg1d$d4g@cville-srv.wam.umd.edu>
  15.            jsquires@wam.umd.edu "jeffrey d squires" writes:
  16.  
  17. >I have the following:
  18. >
  19. >typedef struct {
  20. >        int zero;
  21. >        int one;
  22. >        int two;
  23. >        int three;
  24. >        int four;
  25. >        int five;
  26. >        int six;
  27. >        int seven_or_more;
  28. >} hist_type;
  29.  
  30. Just a thought (not really relevant to your question) but this looks like
  31. it may be better built from an array.
  32.  
  33. >
  34. >hist_type histogram;
  35. >int num=2;
  36. >
  37. >histogram.zero = 0;
  38. >histogram.one = 0;
  39. >histogram.two = 0;
  40. >histogram.three = 0;
  41. >histogram.four = 0;  /* at this point, value of num changes from 2 to 0!!!*/
  42.  
  43. How can you tell?
  44.  
  45. >Is there a limit on the number of bytes allowed inside of a struct?
  46.  
  47. Possibly but that isn't an issue here.
  48.  
  49. >I am positive that the value of num changes from 2 before the last 
  50. >assignment to 0 after it.  Any ideas?
  51.  
  52. Post a complete program that goes wrong. The problem is almost certainly
  53. in part of the code you haven't posted here.
  54.  
  55. > Is this a bug in gcc?  Unix?
  56.  
  57. Possible but very unlikely.
  58.  
  59. -- 
  60. -----------------------------------------
  61. Lawrence Kirby | fred@genesis.demon.co.uk
  62. Wilts, England | 70734.126@compuserve.com
  63. -----------------------------------------
  64.